//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2008 Manu Mital mital.manu@gmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


#pragma once

// CBiblePage dialog

#include "MyToolBar.h"
#include "afxwin.h"
#include "SwordBibleFonts.h"
#include "SwordBibleDoc.h"
#include "afxcmn.h"
#include "AutoRichEditCtrl.h"
#include "RangeSet.h"
#include "CopyManager.h"





class CBiblePage : public CPropertyPage
{
	DECLARE_DYNAMIC(CBiblePage)

public:
	CBiblePage();
	static int staticPageCount;
	sword::SWModule* pModule;
	static int active;
	static sword::SWModule* pModuleTip;
	static sword::SWModule* pGreek;      // pointer to greek strong's numbers
	static sword::SWModule* pHebrew;	// pointer to Hebrew strong's numbers 
	static sword::SWModule* pThayer;	// pointer to Thayer
	static sword::SWModule* pRobinson;	// pointer to Robinson
	sword::SWModule* p;                 // temporary sword module pointer
	virtual ~CBiblePage();
	static CSwordBibleFonts font;
	static CString ActiveMainFrameCommand;
					
	CAutoRichEditCtrl RTFCtrl;
	CAutoRichEditCtrl SplitRich;
	CRangeSet VerseLimits;
	CRangeSet StrongLimits;
	CRangeSet MorphLimits;
	CRangeSet XLimits;
	CStringArray Footnotes;
	CStringArray Xrefs;
	

    CString chapText;


// Dialog Data
	enum { IDD = IDD_BIBLEPAGE };

protected:
	CMyToolBar m_wndFormatBar;
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	afx_msg void OnCopy();					// Copy selected text to clipboard
	afx_msg void OnSelectAll();
	afx_msg void OnMainDisplayOptions();
	afx_msg void OnSearch();				// search the displayed version of bible
	afx_msg void OnCopyManager();
	afx_msg LONG OnMainFrameCommand(UINT, LONG);
	afx_msg void OnNextChapter();
	afx_msg void OnPreviousChapter();
	afx_msg void OnPrint();
	afx_msg void OnShowVersions();
	

	
	afx_msg void OnZoom();
	afx_msg void OnUpdateZoom(CCmdUI *pCmdUI);

	afx_msg void OnSplit();
	afx_msg void OnUpdateSplit(CCmdUI *pCmdUI);

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
	afx_msg void OnSize(UINT nType, int cx, int cy);

private:
	// this function loads the toolbar on the bible page
	int LoadToolbar(void);
	void ZoomText();
	void OnRightButtonDown();

	
public:
	// display the relevant chapter text in the bible page window
	void ShowChapter(void);
	virtual BOOL OnSetActive();
	// moves the static text box on the bible page. This static box contains the title of the book and chapter being displayed
	void MoveTitle(void);

	void AddFootNotes(CString& VerseText, int verse);
	void AddHeadings(CString& Text);
	void AddXref(CString& VerseText, int verse);
	void SetVerseLimits(CStringArray& va);
	void HighlightVerse();
	void SetStrongLimits();
	void SetMorphLimits();
	void SetXLimits();
	    
	void SizeRichEdits();
	

	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR,   LRESULT *pResult);
	afx_msg void OnEnMsgfilter(NMHDR *pNMHDR, LRESULT *pResult);

	
};
